
var getStackTrace = function () {
    var obj = {};
    Error.captureStackTrace(obj, getStackTrace);
    return obj.stack;
};
  

module.exports = {
    print_r(error){
        var stack = getStackTrace() || ""
        var matchResult = stack.match(/\(.*?\)/g) || []
        var line = matchResult[1] || ""
        for (var i in arguments) {
        }
        if (typeof arguments[i] == 'object') {
            arguments[i] = JSON.stringify(arguments[i])
        }
        
        const date = new Date();
        console.log('start ['+date+']=================>');
        console.log(error);
        console.log(line.replace("(", "").replace(")", ""));
        console.log('<================= end ['+date+']');
    }
}